{template 'public/header'}
{template 'public/comhead'}
<style type="text/css">
    .nav-tabs{
        margin-top: 30px;
    }
    .nav-tabs>li>a:hover{
        color: #333;
        border-color: #31C2A5;
        background-color: white;
    }
    .nav-tabs > li.active > a,.nav-tabs > li.active > a:hover{
        background-color: #31C2A5;
        color: white;
        border-color: #31C2A5;
    }
    .nav.nav-tabs{border-color: #31C2A5;}
    .yg5_key>div{float: left;line-height: 34px;}
    .store_td1{height: 45px;}
    .store_list_img{width: 60px;height: 60px;}
    .yg5_tabel{border-color: #e5e5e5;outline: 1px solid #e5e5e5;}
    .yg5_tr2>td{padding: 15px;border: 1px solid #e5e5e5;text-align: center;}
    .yg5_tr1>td{
        border: 1px solid #e5e5e5;
        padding-left: 15px;
        background-color: #FAFAFA;
        font-weight: bold;
        text-align: center;
    }
    .yg5_btn{background-color: #EEEEEE;color: #333;border: 1px solid #E4E4E4;border-radius: 6px;width: 100px;height: 34px;}
</style>
<ul class="nav nav-tabs">    
    <li class="active"><a href="{php echo $this->createWebUrl('yellowtype')}">信息分类管理</a></li>
    <li><a href="{php echo $this->createWebUrl('addyellowtype')}">添加信息分类</a></li>
</ul>
<div class="main">
    <div class="panel panel-default">
        <div class="panel-body">
            <a class="btn btn-primary" href="javascript:location.reload()"><i class="fa fa-refresh"></i>刷新</a>
        </div>
    </div>
    <!-- 门店列表部分开始 -->
        <div class="panel panel-default">
            <div class="panel-heading">
                信息分类管理
            </div>
            <div class="panel-body" style="padding: 0px 15px;">
                <div class="row">
                    <table class="yg5_tabel col-md-12">
                        <tr class="yg5_tr1">
                            <td class="store_td1 col-md-1">顺序</td>
                            <td class="col-md-2">图标</td>
                            <td class="col-md-2">信息分类名称</td>
                            <!-- <td class="col-md-2">价格</td> -->
                            <td class="col-md-2">状态</td>
                            <td class="col-md-3">操作</td>
                        </tr>
                        {loop $list $row}
                        <tr class="yg5_tr2">
                            <td class="num{$row['id']}">
                            	<span class="numspan{$row['id']}">{$row['num']}</span>
                        		<input style="display: none;width: 100%;" type="number" name="num{$row['id']}" class="numinp{$row['id']}" value="{$row['num']}" />
                            	<script type="text/javascript">
								    $(function(){
								    	$(".num{$row['id']}").each(function(index){
								             $(this).dblclick(function(){
								                $(".numinp{$row['id']}").eq(index).show().focus();
								                $(".numspan{$row['id']}").eq(index).hide();							                
								            });
								        });
								        $(".numinp{$row['id']}").each(function(index){
								            $(this).blur(function(){            
								                $(".numinp{$row['id']}").eq(index).hide();
								                $(".numspan{$row['id']}").eq(index).show();
								                var text = $(".numspan{$row['id']}").html();
								                var inp = $(" input[ name='num{$row['id']}' ] ").val();
								                $(".numspan{$row['id']}").html(inp);
								                console.log(inp);
								                id = {$row['id']};
										        num = inp;
										    	$.ajax({
										    		type:"post",
										    		url:"{$_W['siteroot']}/app/index.php?i={$_W['uniacid']}&c=entry&do=UpdType&m=zh_tcwq",
										    		dataType:"text",
											        data:{id:id,num:num},
											        success:function(data){
											        	console.log(data);
												    }
										    	})
								        
								            });
								        });
								    })
								</script>
                            </td>
                            <td>
                                <img class="store_list_img" src="{media  $row['img']}" alt=""/>                                
                            </td>
                            <td>{$row['type_name']}</td>
                           <!--  <td class="money{$row['id']}">
                               <span class="moneyspan{$row['id']}">{$row['money']}</span>
                                                           <input style="display: none;width: 100%;" type="text" name="money{$row['id']}" class="moneyinp{$row['id']}" value="{$row['money']}" />
                                                           <script type="text/javascript">
                                                               $(function(){
                                                                   $(".money{$row['id']}").each(function(index){
                                                                        $(this).dblclick(function(){
                                                                           $(".moneyinp{$row['id']}").eq(index).show().focus();
                                                                           $(".moneyspan{$row['id']}").eq(index).hide();                                            
                                                                       });
                                                                   });
                                                                   $(".moneyinp{$row['id']}").each(function(index){
                                                                       $(this).blur(function(){            
                                                                           $(".moneyinp{$row['id']}").eq(index).hide();
                                                                           $(".moneyspan{$row['id']}").eq(index).show();
                                                                           var text = $(".moneyspan{$row['id']}").html();
                                                                           var inp = $(" input[ name='money{$row['id']}' ] ").val();
                                                                           $(".moneyspan{$row['id']}").html(inp);
                                                                           // console.log(inp);
                                                                           id = {$row['id']};
                                                                           money = inp;
                                                                           $.ajax({
                                                                               type:"post",
                                                                               url:"{$_W['siteroot']}/app/index.php?i={$_W['uniacid']}&c=entry&do=UpdType&m=zh_tcwq",
                                                                               dataType:"text",
                                                                               data:{id:id,money:money},
                                                                               success:function(data){
                                                                                   console.log(data);
                                                                               }
                                                                           })
                                                                   
                                                                       });
                                                                   });
                                                               })
                                                           </script>
                           </td> -->
                            <td>{if $row['state']==1} <span class="label label-info">  <a href="{php echo $this->createWebUrl('yellowtype', array('id' => $row['id'],'op'=>change,'state'=>2))}"   >启用</a></span>{elseif $row['state']==2} <span class="label label-danger"><a href="{php echo $this->createWebUrl('yellowtype', array('id' => $row['id'],'op'=>change,'state'=>1))}">禁用</a></span>{/if}</td>
                            <td><a class="btn btn-warning btn-sm" href="{php echo $this->createWebUrl('addyellowtype', array('id' => $row['id']))}" title="编辑">改</a>&nbsp;&nbsp;
                           <button type="button" class="btn btn-danger btn-sm" data-toggle="modal" data-target="#myModal{$row['id']}">删</button>
                            </td>
                        </tr>
                         <div class="modal fade" id="myModal{$row['id']}" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
                      <div class="modal-dialog" role="document">
                        <div class="modal-content">
                          <div class="modal-header">
                            <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                            <h4 class="modal-title" id="myModalLabel" style="font-size: 20px;">提示</h4>
                        </div>
                        <div class="modal-body" style="font-size: 20px">
                            确定删除么？
                        </div>
                        <div class="modal-footer">
                        <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                            <a href="{php echo $this->createWebUrl('yellowtype', array('id' => $row['id'],'op'=>'delete'))}" type="button" class="btn btn-info" >确定</a>
                        </div>
                    </div>
                </div>
            </div>
                        {/loop}
                       
                    </table>
                </div>
            </div>
        </div>
    {$pager}
</div>
<script type="text/javascript">
  $(function(){
      $("#frame-4").show();
      $("#yframe-4").addClass("wyactive");
  })
</script>